home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / sputils.zip / DEMO1.BAT < prev    next >
DOS Batch File  |  1991-01-08  |  16KB  |  462 lines

  1. echo off
  2. rem   ------------------------------------------------------
  3. rem                       batch file 1
  4. rem
  5. rem                (C) speter software, January 1991.
  6. rem   ------------------------------------------------------
  7. rem    this batch file will:
  8. rem      1  demonstrate the function of the batch utilities;
  9. rem      2  show the documentation for the utilities;
  10. rem      3  show demonstrations of the utilities.
  11. rem   ------------------------------------------------------
  12. rem   This section sets up the DOS environment variables used in this
  13. rem   batch file.
  14. rem set (ANSI) text colour to white on blue
  15. echo H1H
  16. hasmouse
  17. if errorlevel 1 set _um=T
  18. rem   suppress text cursor if mouse is available:
  19. if %_um%==T set _t=/t
  20. rem   chose which "more" command to use:
  21. if %_um%==T set _m=mormouse /c
  22. if not %_um%==T set _m=more
  23. rem   choose which prompt to use:
  24. if %_um%==T set _p=/t press a button to continue
  25. if not %_um%==T set _p=press any key to continue
  26.  
  27. rem --------------------------------------------------
  28. rem page 0 (general intro)
  29. rem --------------------------------------------------
  30. copyrect demo-p0.scr 0 1 1
  31. askmouse 51 23 52 23 Xx* 51 23 /m
  32. if errorlevel 203 goto ok
  33. if errorlevel 202 goto end
  34. rem --------------------------------------------------
  35. rem page 1 (provides short descriptions of utilities)
  36. rem --------------------------------------------------
  37. copyrect demo-p1.scr 0 1 1
  38. copyrect 0 37 2 80 25 1 37 2
  39. :in-p1
  40. askmouse 26 3 36 22 q 26 11 %_t%
  41. rem ---- mouse (or text cursor) entry
  42. if errorlevel 122 goto end
  43. if errorlevel 121 goto demos
  44. if errorlevel 120 goto docs
  45. if errorlevel 119 goto in-p1
  46. if errorlevel 118 BoxText /s1 s 37 17 113 Removes TABs from an file, replacing!them with SPACEs, writes the result to!a file.
  47. if errorlevel 117 BoxText /s1 s 37 16 113 Deletes a word (or series of) from a!file, the result is written to another!file.
  48. if errorlevel 116 BoxText /s1 s 37 15 113 Deletes any characters within a spec. !column range, writes the result to!a file.
  49. if errorlevel 115 BoxText /s1 s 37 14 113 Displays all (255) text attributes -  !foreground, background colour &!blinking.
  50. if errorlevel 114 BoxText /s1 s 37 13 113 Reports the length of the longest line!of a specified text file & the no.!of lines.
  51. if errorlevel 113 BoxText /s1 s 37 12 113 Show the Disk Usage - total bytes used!in the spec. directory and sub-dirs.
  52. if errorlevel 112 BoxText /s1 s 37 11 113 Simple decimal to binary (and Hex)   !converter (numbers less than 65768).
  53. if errorlevel 111 goto in-p1
  54. if errorlevel 110 BoxText /s1 s 37  9 113 Similar to DOS "more" command, except !uses mouse-button press INSTEAD of a!keypress.
  55. if errorlevel 109 BoxText /s1 s 37  8 113 Used in batch files to determine mouse!availability, sets the DOS errorlevel.
  56. if errorlevel 108 BoxText /s1 s 37  7 113 Display a message using a specified   !text attribute.
  57. if errorlevel 107 BoxText /s1 s 37  6 113 Copy part (or all) of a text screen!to/from disk & other (nonvisible) text!screens.
  58. if errorlevel 106 BoxText /s1 s 37  5 113 Wait for a mouse-button or key press;!optionally display a message before   !waiting.
  59. if errorlevel 105 BoxText /s1 s 37  4 113 Display a message inside a box using a!specified text attribute.!* *  used here  * *
  60. if errorlevel 104 BoxText /s1 s 37  3 113 Display a box using a specified text  !attribute, by default clears inside!the box.
  61. if errorlevel 103 BoxText /s1 s 37  2 113 For selections in batch files, uses a !mouse, cursor keys &/or specified!characters.
  62. BoxText /s1 s 73 23 103 OK
  63. askmouse 75 24 78 24 * 75 24 %_t%
  64. copyrect 1 37 2 80 25 0 37 2
  65. goto in-p1
  66. rem --------------------------------------------------
  67. rem page 2 (displays full documentation on utilities)
  68. rem --------------------------------------------------
  69. :docs
  70. copyrect 0 1 1 80 25 1 1 1      (copy display page 0 to display page 1)
  71. copyrect demo-p2.scr 2 1 1      (read 2nd page from file)
  72. :in-p2
  73. copyrect 2 1 1 80 25 0 1 1      (copy 2nd page to display page 0)
  74. askmouse 26 3 34 20 q 26 11 %_t%
  75. rem ---- mouse (or text cursor) entry
  76. if errorlevel 120 goto P2return
  77. if errorlevel 119 goto in-p2
  78. if errorlevel 118 %_m% < striptab.doc
  79. if errorlevel 117 %_m% < stripstr.doc
  80. if errorlevel 116 %_m% < stripcol.doc
  81. if errorlevel 115 %_m% < showattr.doc
  82. if errorlevel 114 %_m% < linelen.doc
  83. if errorlevel 113 %_m% < du.doc
  84. if errorlevel 112 %_m% < binary.doc
  85. if errorlevel 111 goto in-p2
  86. if errorlevel 110 %_m% < mormouse.doc
  87. if errorlevel 109 %_m% < hasmouse.doc
  88. if errorlevel 108 %_m% < dtext.doc
  89. if errorlevel 107 %_m% < copyrect.doc
  90. if errorlevel 106 %_m% < butnpres.doc
  91. if errorlevel 105 %_m% < boxtext.doc
  92. if errorlevel 104 %_m% < box.doc
  93. if errorlevel 103 %_m% < askmouse.doc
  94. BoxText /s1 s 73 23 103 OK
  95. askmouse 75 24 78 24 * 75 24 %_t%
  96. goto in-p2
  97. :P2return
  98. copyrect 2 1 1 30 1  1 1 1   ( rewrite portion that gets cleared by "cls" )
  99. copyrect 1 1 1 80 25 0 1 1   ( restore page 1 to display page 0 )
  100. goto in-p1
  101. rem --------------------------------------------------
  102. rem page 3 (gives demonstrations of the utilities)
  103. rem --------------------------------------------------
  104. :demos
  105. copyrect 0 1 1 80 25 1 1 1      (copy display page 0 to display page 1)
  106. copyrect demo-p3.scr 3 1 1      (read 3rd page from file)
  107. :in-p3
  108. copyrect 3 1 1 80 25 0 1 1      (copy 3rd page to display page 0)
  109. askmouse 26 3 34 20 q 26 11 %_t%
  110. rem ---- mouse (or text cursor) entry
  111. if errorlevel 120 goto P3return
  112. if errorlevel 119 goto in-p3
  113. if errorlevel 118 goto striptab
  114. if errorlevel 117 goto stripstr
  115. if errorlevel 116 goto stripcol
  116. if errorlevel 115 goto showattr
  117. if errorlevel 114 goto linelen
  118. if errorlevel 113 goto du
  119. if errorlevel 112 goto binary
  120. if errorlevel 111 goto in-p3
  121. if errorlevel 110 goto mormouse
  122. if errorlevel 109 goto hasmouse
  123. if errorlevel 108 goto dtext
  124. if errorlevel 107 goto copyrect
  125. if errorlevel 106 goto butnpres
  126. if errorlevel 105 goto boxtext
  127. if errorlevel 104 goto box
  128. if errorlevel 103 goto askmouse
  129. BoxText /s1 s 73 23 103 OK
  130. askmouse 75 24 78 24 * 75 24 %_t%
  131. goto in-p3
  132. :P3return
  133. copyrect 3 1 1 30 1  1 1 1   ( rewrite portion that gets cleared by "cls" )
  134. copyrect 1 1 1 80 25 0 1 1   ( restore page 1 to display page 0 )
  135. goto in-p1
  136. rem --------------------------------------------------------
  137. :striptab
  138. cls
  139. echo          STRIP-TABs
  140. echo  
  141. echo This demonstration will strip the tab characters from a file called TABS.TXT
  142. echo (supplied with the utilities);  the resulting text will then be displayed on
  143. echo the screen.
  144. echo  
  145. echo The command line used will be:
  146. echo  
  147. echo   STRIPTAB tabs.txt con
  148. echo  
  149. butnpres %_p%
  150. echo  
  151. STRIPTAB tabs.txt con
  152. BoxText /s1 s 73 23 103 OK
  153. askmouse 75 24 78 24 * 75 24 %_t%
  154. goto in-p3
  155. rem --------------------------------------------------------
  156. :stripstr
  157. cls
  158. echo          STRIP-STRING
  159. echo  
  160. echo This demonstration will strip the string "efghijk" from a file called
  161. echo LETTERS.TXT (supplied with the utilities);  the resulting text will then be
  162. echo displayed on the screen.
  163. echo  
  164. echo LETTERS.TXT contains the string "abcdefghijklmnopqrstuvwxyz" 5 times.
  165. echo  
  166. echo The command line used will be:
  167. echo  
  168. echo   STRIPSTR /sefghijk letters.txt con
  169. echo  
  170. butnpres %_p%
  171. echo  
  172. STRIPSTR /sefghijk letters.txt con
  173. BoxText /s1 s 73 23 103 OK
  174. askmouse 75 24 78 24 * 75 24 %_t%
  175. goto in-p3
  176. rem --------------------------------------------------------
  177. :stripcol
  178. cls
  179. echo  
  180. echo          STRIP COLUMN RANGE
  181. echo  
  182. echo This demonstration will strip all the characters between column 10 and column
  183. echo 20 from the file LETTERS.TXT (supplied with the utilities); the resulting text
  184. echo will then be displayed on the screen.
  185. echo  
  186. echo LETTERS.TXT contains the string "abcdefghijklmnopqrstuvwxyz" 5 times.
  187. echo                                         10*---------*20
  188. echo  
  189. echo the resulting text should be "abcdefghiuvwxyz" 5 times.
  190. echo  
  191. echo The command line used will be:
  192. echo  
  193. echo   STRIPCOL 10 20 letters.txt con
  194. echo  
  195. butnpres %_p%
  196. echo  
  197. STRIPCOL 10 20 letters.txt con
  198. BoxText /s1 s 73 23 103 OK
  199. askmouse 75 24 78 24 *